if bkgnd field "Print" is empty then put false into bkgnd field "Print"
put number of this card - the number of first card of this bkgnd + 1 into field "Number"
setPrintButton
click at loc of field "Pay to"
tabKey
end openCard
on closeField
put true into bkgnd field "Print"
setPrintButton
get the short name of the target
if it is not "Date" and it is not "Year" then putDate
end closeField
on setPrintButton
set hilite of bkgnd button "Print" to bkgnd field "Print"
end setPrintButton
on putDate
get item 2 of the abbrev date
delete first char of it
put it into field "Date"
put char 3 to 4 of word 4 of the abbrev date into field "Year"
put true into bkgnd field "Print"
setPrintButton
end putDate
-- TextAmount -- returns text version of numeric dollars and cents
-- amount.
function textAmount amount
put char (number of chars in amount) - 1 to (number of chars in amount) of amount into cents
get trunc(amount)
if it is 0 then get "zero "
else
put it mod 100 into units
put it div 100 into hundreds
get empty
if hundreds is not zero then
if hundreds mod 10 is zero then get text100(hundreds div 10) && "thousand "
else get text100(hundreds) && "hundred "
end if
if units is not zero then put text100(units) & space after it
end if
put "and " & cents & "/100*****************************************************************" after it
put toUpper(first char of it) into first char of it
return it
end textAmount
-- text100 -- Utility function for textAmount.
function text100 n
put "one two three four five six seven eight nine ten" && "eleven twelve thirteen fourteen fifteen sixteen seventeen" && "eighteen nineteen" into digits
-- handle number less than 20
if n < 20 then
if n = 0 then get "zero"
else get word n of digits
else
-- handle larger numbers
put n mod 10 into units -- separate units and tens
put n div 10 into tens
get word tens of "ten twenty thirty forty fifty sixty seventy eighty ninety"
if units <> 0 then put "-" & word units of digits after it
end if
return it
end text100
-- toUpper -- Convert a lower case letter to upper case.
function toUpper a
return numToChar(charToNum(a) - 32)
end toUpper
-- part 5 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=281 top=105 right=122 bottom=348
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Date
-- part 6 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=360 top=105 right=122 bottom=384
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Year
-- part 3 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=86 top=145 right=162 bottom=366
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Pay to
----- HyperTalk script -----
on closeField
if last character of background field "Pay to" <> "*" then put "*************************************************************" after background field "Pay to"
pass closeField
end closeField
-- part 2 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=388 top=145 right=162 bottom=468
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 4
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: Amount
----- HyperTalk script -----
on closeField
repeat while first char of field "amount" is "*"
delete first char of field "amount"
end repeat
if number of chars in field "amount" < 3 then put ".00" after field "amount"
else if char (number of chars in field "amount") - 2 of field "amount" <> "." then put ".00" after field "amount"
put textAmount(field "Amount") into field "Text Amount"
repeat for 9 - (number of chars in field "amount") times